unit BUDGET_VOUCHER;


interface
uses
  Classes,SysUtils,DB,Uni,UniEngine,Math;

type
  TBUDGETVOUCHER=class(TUniEngine)
  private
    FBVOUID   : string;
    FTOCTRLID : string;
    FFROMCTRLID: string;
    FSETYEAR  : Extended;       
    FRGCODE   : string;
    FBUDGETMONEY: Extended;
    FCHECKMONEY: Extended;
    FISVALID  : Extended;
    FISEND    : Extended;
    FAPPROVEDATE: string;
    FCREATEDATE: string;
    FCREATEUSER: string;
    FLATESTOPDATE: string;
    FLATESTOPUSER: string;
    FLASTVER  : string;
    FAUTOREALPAY: Extended;
    FBUDGETADJUST: string;
    FBUDGETCATEGORY: string;
    FBUDGETVALID: string;
    FHODE1    : string;
    FHODE2    : string;
    FHODE3    : string;
    FHODE4    : string;
    FHODE5    : string;
    FBVOUBILLID: string;
    FADJUSTID : string;
    FADJUSTWAY: Extended;
    FGRANTID  : string;
    FSUMMARY  : string;
    FBILLTYPECODE: string;
    FBUDGETTYPECODE: string;
    FBAID     : string;
    FBACODE   : string;
    FBANAME   : string;
    FREPLACEMODEL: Extended;
    FRCID     : Extended;
    FCCID     : Extended;
    FBUDGETGROUPID: string;
    FISNCYS   : Extended;
  protected
    procedure SetParameters;override;
    function  GetStrInsert:string;override;
    function  GetStrUpdate:string;override;
    function  GetStrDelete:string;override;
  public
    function  GetStrsIndex:string;override;
  public
    function  GetNextIdex:Integer;overload;
    function  GetNextIdex(AUniConnection:TUniConnection):Integer;overload;
  public
    function  CheckExist(AUniConnection:TUniConnection):Boolean;override;
  public
    destructor  Destroy; override;
    constructor Create;  
  published
    property BVOUID   : string read FBVOUID    write FBVOUID;
    property TOCTRLID : string read FTOCTRLID  write FTOCTRLID;
    property FROMCTRLID: string read FFROMCTRLID write FFROMCTRLID;
    property SETYEAR  : Extended read FSETYEAR   write FSETYEAR;
    property RGCODE   : string read FRGCODE    write FRGCODE;
    property BUDGETMONEY: Extended read FBUDGETMONEY write FBUDGETMONEY;
    property CHECKMONEY: Extended read FCHECKMONEY write FCHECKMONEY;
    property ISVALID  : Extended read FISVALID   write FISVALID;
    property ISEND    : Extended read FISEND     write FISEND;
    property APPROVEDATE: string read FAPPROVEDATE write FAPPROVEDATE;
    property CREATEDATE: string read FCREATEDATE write FCREATEDATE;
    property CREATEUSER: string read FCREATEUSER write FCREATEUSER;
    property LATESTOPDATE: string read FLATESTOPDATE write FLATESTOPDATE;
    property LATESTOPUSER: string read FLATESTOPUSER write FLATESTOPUSER;
    property LASTVER  : string read FLASTVER   write FLASTVER;
    property AUTOREALPAY: Extended read FAUTOREALPAY write FAUTOREALPAY;
    property BUDGETADJUST: string read FBUDGETADJUST write FBUDGETADJUST;
    property BUDGETCATEGORY: string read FBUDGETCATEGORY write FBUDGETCATEGORY;
    property BUDGETVALID: string read FBUDGETVALID write FBUDGETVALID;
    property HODE1    : string read FHODE1     write FHODE1;
    property HODE2    : string read FHODE2     write FHODE2;
    property HODE3    : string read FHODE3     write FHODE3;
    property HODE4    : string read FHODE4     write FHODE4;
    property HODE5    : string read FHODE5     write FHODE5;
    property BVOUBILLID: string read FBVOUBILLID write FBVOUBILLID;
    property ADJUSTID : string read FADJUSTID  write FADJUSTID;
    property ADJUSTWAY: Extended read FADJUSTWAY write FADJUSTWAY;
    property GRANTID  : string read FGRANTID   write FGRANTID;
    property SUMMARY  : string read FSUMMARY   write FSUMMARY;
    property BILLTYPECODE: string read FBILLTYPECODE write FBILLTYPECODE;
    property BUDGETTYPECODE: string read FBUDGETTYPECODE write FBUDGETTYPECODE;
    property BAID     : string read FBAID      write FBAID;
    property BACODE   : string read FBACODE    write FBACODE;
    property BANAME   : string read FBANAME    write FBANAME;
    property REPLACEMODEL: Extended read FREPLACEMODEL write FREPLACEMODEL;
    property RCID     : Extended read FRCID      write FRCID;
    property CCID     : Extended read FCCID      write FCCID;
    property BUDGETGROUPID: string read FBUDGETGROUPID write FBUDGETGROUPID;
    property ISNCYS   : Extended read FISNCYS    write FISNCYS;    
  public
    class function  ReadDS(AUniQuery:TUniQuery):TUniEngine;override;
    class procedure ReadDS(AUniQuery:TUniQuery;var Result:TUniEngine);override;
    class function  CopyIt(ABUDGETVOUCHER:TBUDGETVOUCHER):TBUDGETVOUCHER;overload;        
    class procedure CopyIt(ABUDGETVOUCHER:TBUDGETVOUCHER;var Result:TBUDGETVOUCHER);overload;       
  end;

implementation

{ TBUDGETVOUCHER }
procedure TBUDGETVOUCHER.SetParameters;
begin
  inherited;
  with FUniSQL.Params do
  begin
    case FOptTyp of
      otAddx:
      begin
        ParamByName('B_VOU_ID').Value := BVOUID;
        ParamByName('TOCTRLID').Value := TOCTRLID;
        ParamByName('FROMCTRLID').Value := FROMCTRLID;
        ParamByName('SET_YEAR').Value := SETYEAR;
        ParamByName('RG_CODE').Value := RGCODE;
        ParamByName('BUDGET_MONEY').Value := BUDGETMONEY;
        ParamByName('CHECK_MONEY').Value := CHECKMONEY;
        ParamByName('IS_VALID').Value := ISVALID;
        ParamByName('IS_END').Value := ISEND;
        ParamByName('APPROVE_DATE').Value := APPROVEDATE;
        ParamByName('CREATE_DATE').Value := CREATEDATE;
        ParamByName('CREATE_USER').Value := CREATEUSER;
        ParamByName('LATEST_OP_DATE').Value := LATESTOPDATE;
        ParamByName('LATEST_OP_USER').Value := LATESTOPUSER;
        ParamByName('LAST_VER').Value := LASTVER;
        ParamByName('AUTO_REALPAY').Value := AUTOREALPAY;
        ParamByName('BUDGET_ADJUST').Value := BUDGETADJUST;
        ParamByName('BUDGET_CATEGORY').Value := BUDGETCATEGORY;
        ParamByName('BUDGET_VALID').Value := BUDGETVALID;
        ParamByName('HODE1').Value := HODE1;
        ParamByName('HODE2').Value := HODE2;
        ParamByName('HODE3').Value := HODE3;
        ParamByName('HODE4').Value := HODE4;
        ParamByName('HODE5').Value := HODE5;
        ParamByName('B_VOUBILL_ID').Value := BVOUBILLID;
        ParamByName('ADJUST_ID').Value := ADJUSTID;
        ParamByName('ADJUST_WAY').Value := ADJUSTWAY;
        ParamByName('GRANT_ID').Value := GRANTID;
        ParamByName('SUMMARY').Value := SUMMARY;
        ParamByName('BILLTYPE_CODE').Value := BILLTYPECODE;
        ParamByName('BUDGETTYPE_CODE').Value := BUDGETTYPECODE;
        ParamByName('BA_ID').Value := BAID;
        ParamByName('BA_CODE').Value := BACODE;
        ParamByName('BA_NAME').Value := BANAME;
        ParamByName('REPLACE_MODEL').Value := REPLACEMODEL;
        ParamByName('RCID').Value := RCID;
        ParamByName('CCID').Value := CCID;
        ParamByName('BUDGET_GROUPID').Value := BUDGETGROUPID;
        ParamByName('IS_NCYS').Value := ISNCYS; 
      end;
      otEdit:
      begin
        ParamByName('B_VOU_ID').Value := BVOUID;
        ParamByName('TOCTRLID').Value := TOCTRLID;
        ParamByName('FROMCTRLID').Value := FROMCTRLID;
        ParamByName('SET_YEAR').Value := SETYEAR;
        ParamByName('RG_CODE').Value := RGCODE;
        ParamByName('BUDGET_MONEY').Value := BUDGETMONEY;
        ParamByName('CHECK_MONEY').Value := CHECKMONEY;
        ParamByName('IS_VALID').Value := ISVALID;
        ParamByName('IS_END').Value := ISEND;
        ParamByName('APPROVE_DATE').Value := APPROVEDATE;
        ParamByName('CREATE_DATE').Value := CREATEDATE;
        ParamByName('CREATE_USER').Value := CREATEUSER;
        ParamByName('LATEST_OP_DATE').Value := LATESTOPDATE;
        ParamByName('LATEST_OP_USER').Value := LATESTOPUSER;
        ParamByName('LAST_VER').Value := LASTVER;
        ParamByName('AUTO_REALPAY').Value := AUTOREALPAY;
        ParamByName('BUDGET_ADJUST').Value := BUDGETADJUST;
        ParamByName('BUDGET_CATEGORY').Value := BUDGETCATEGORY;
        ParamByName('BUDGET_VALID').Value := BUDGETVALID;
        ParamByName('HODE1').Value := HODE1;
        ParamByName('HODE2').Value := HODE2;
        ParamByName('HODE3').Value := HODE3;
        ParamByName('HODE4').Value := HODE4;
        ParamByName('HODE5').Value := HODE5;
        ParamByName('B_VOUBILL_ID').Value := BVOUBILLID;
        ParamByName('ADJUST_ID').Value := ADJUSTID;
        ParamByName('ADJUST_WAY').Value := ADJUSTWAY;
        ParamByName('GRANT_ID').Value := GRANTID;
        ParamByName('SUMMARY').Value := SUMMARY;
        ParamByName('BILLTYPE_CODE').Value := BILLTYPECODE;
        ParamByName('BUDGETTYPE_CODE').Value := BUDGETTYPECODE;
        ParamByName('BA_ID').Value := BAID;
        ParamByName('BA_CODE').Value := BACODE;
        ParamByName('BA_NAME').Value := BANAME;
        ParamByName('REPLACE_MODEL').Value := REPLACEMODEL;
        ParamByName('RCID').Value := RCID;
        ParamByName('CCID').Value := CCID;
        ParamByName('BUDGET_GROUPID').Value := BUDGETGROUPID;
        ParamByName('IS_NCYS').Value := ISNCYS; 
      end;  
      otDelt:
      begin
        ParamByName('B_VOU_ID').Value := BVOUID;
 
      end;  
    end;
  end;
end;

function TBUDGETVOUCHER.CheckExist(AUniConnection: TUniConnection): Boolean;
begin
  Result:=CheckExist('BUDGET_VOUCHER',['B_VOU_ID',BVOUID],AUniConnection);
end;

function TBUDGETVOUCHER.GetNextIdex: Integer;
begin

end;

function TBUDGETVOUCHER.GetNextIdex(AUniConnection: TUniConnection): Integer;
var
  MaxA,MaxB:Integer;
begin
  MaxA  :=CheckField('SELECT MAX(CAST(B_VOU_ID AS INT))+1 AS ASVALUE FROM BUDGET_VOUCHER','ASVALUE',AUniConnection);
  MaxB  :=CheckField('SELECT MAX(CAST(B_VOUBILL_ID AS INT))+1 AS ASVALUE FROM BUDGET_VOUCHER_BILL','ASVALUE',AUniConnection);
  Result:=Max(MaxA,MaxB);
end;


function TBUDGETVOUCHER.GetStrDelete: string;
begin
  Result:='DELETE FROM BUDGET_VOUCHER WHERE   B_VOU_ID=:B_VOU_ID';
end;

function TBUDGETVOUCHER.GetStrInsert: string;
begin
  Result:='INSERT INTO BUDGET_VOUCHER'
         +'    ( B_VOU_ID, TOCTRLID, FROMCTRLID, SET_YEAR, RG_CODE'
         +'    , BUDGET_MONEY, CHECK_MONEY, IS_VALID, IS_END, APPROVE_DATE'
         +'    , CREATE_DATE, CREATE_USER, LATEST_OP_DATE, LATEST_OP_USER'
         +'    , LAST_VER, AUTO_REALPAY, BUDGET_ADJUST, BUDGET_CATEGORY'
         +'    , BUDGET_VALID, HODE1, HODE2, HODE3, HODE4, HODE5, B_VOUBILL_ID'
         +'    , ADJUST_ID, ADJUST_WAY, GRANT_ID, SUMMARY, BILLTYPE_CODE'
         +'    , BUDGETTYPE_CODE, BA_ID, BA_CODE, BA_NAME, REPLACE_MODEL'
         +'    , RCID, CCID, BUDGET_GROUPID, IS_NCYS)'
         +'    VALUES'
         +'    (:B_VOU_ID,:TOCTRLID,:FROMCTRLID,:SET_YEAR,:RG_CODE'
         +'    ,:BUDGET_MONEY,:CHECK_MONEY,:IS_VALID,:IS_END,:APPROVE_DATE'
         +'    ,:CREATE_DATE,:CREATE_USER,:LATEST_OP_DATE,:LATEST_OP_USER'
         +'    ,:LAST_VER,:AUTO_REALPAY,:BUDGET_ADJUST,:BUDGET_CATEGORY'
         +'    ,:BUDGET_VALID,:HODE1,:HODE2,:HODE3,:HODE4,:HODE5,:B_VOUBILL_ID'
         +'    ,:ADJUST_ID,:ADJUST_WAY,:GRANT_ID,:SUMMARY,:BILLTYPE_CODE'
         +'    ,:BUDGETTYPE_CODE,:BA_ID,:BA_CODE,:BA_NAME,:REPLACE_MODEL'
         +'    ,:RCID,:CCID,:BUDGET_GROUPID,:IS_NCYS)';
end;

function TBUDGETVOUCHER.GetStrsIndex: string;
begin
  Result:=Format('%S',[BVOUID]);
end;

function TBUDGETVOUCHER.GetStrUpdate: string;
begin
  Result:='UPDATE  BUDGET_VOUCHER SET'
         +'    TOCTRLID=:TOCTRLID,'
         +'    FROMCTRLID=:FROMCTRLID,'
         +'    SET_YEAR=:SET_YEAR,'
         +'    RG_CODE=:RG_CODE,'
         +'    BUDGET_MONEY=:BUDGET_MONEY,'
         +'    CHECK_MONEY=:CHECK_MONEY,'
         +'    IS_VALID=:IS_VALID,'
         +'    IS_END=:IS_END,'
         +'    APPROVE_DATE=:APPROVE_DATE,'
         +'    CREATE_DATE=:CREATE_DATE,'
         +'    CREATE_USER=:CREATE_USER,'
         +'    LATEST_OP_DATE=:LATEST_OP_DATE,'
         +'    LATEST_OP_USER=:LATEST_OP_USER,'
         +'    LAST_VER=:LAST_VER,'
         +'    AUTO_REALPAY=:AUTO_REALPAY,'
         +'    BUDGET_ADJUST=:BUDGET_ADJUST,'
         +'    BUDGET_CATEGORY=:BUDGET_CATEGORY,'
         +'    BUDGET_VALID=:BUDGET_VALID,'
         +'    HODE1=:HODE1,'
         +'    HODE2=:HODE2,'
         +'    HODE3=:HODE3,'
         +'    HODE4=:HODE4,'
         +'    HODE5=:HODE5,'
         +'    B_VOUBILL_ID=:B_VOUBILL_ID,'
         +'    ADJUST_ID=:ADJUST_ID,'
         +'    ADJUST_WAY=:ADJUST_WAY,'
         +'    GRANT_ID=:GRANT_ID,'
         +'    SUMMARY=:SUMMARY,'
         +'    BILLTYPE_CODE=:BILLTYPE_CODE,'
         +'    BUDGETTYPE_CODE=:BUDGETTYPE_CODE,'
         +'    BA_ID=:BA_ID,'
         +'    BA_CODE=:BA_CODE,'
         +'    BA_NAME=:BA_NAME,'
         +'    REPLACE_MODEL=:REPLACE_MODEL,'
         +'    RCID=:RCID,'
         +'    CCID=:CCID,'
         +'    BUDGET_GROUPID=:BUDGET_GROUPID,'
         +'    IS_NCYS=:IS_NCYS'
         +'    WHERE B_VOU_ID=:B_VOU_ID';
end;

constructor TBUDGETVOUCHER.Create;
begin

end;

destructor TBUDGETVOUCHER.Destroy;
begin

  inherited;
end;

class function TBUDGETVOUCHER.ReadDS(AUniQuery: TUniQuery): TUniEngine;
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  Result:=TBUDGETVOUCHER.Create;

  with TBUDGETVOUCHER(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      //if field.fieldname is not all uppercase,please use uppercase().
      FieldName:=Field.FieldName;
      if FieldName='B_VOU_ID' then
      begin
        BVOUID   :=Field.AsString;
      end else
      if FieldName='TOCTRLID' then
      begin
        TOCTRLID :=Field.AsString;
      end else
      if FieldName='FROMCTRLID' then
      begin
        FROMCTRLID:=Field.AsString;
      end else
      if FieldName='SET_YEAR' then
      begin
        SETYEAR  :=Field.AsFloat;
      end else
      if FieldName='RG_CODE' then
      begin
        RGCODE   :=Field.AsString;
      end else
      if FieldName='BUDGET_MONEY' then
      begin
        BUDGETMONEY:=Field.AsFloat;
      end else
      if FieldName='CHECK_MONEY' then
      begin
        CHECKMONEY:=Field.AsFloat;
      end else
      if FieldName='IS_VALID' then
      begin
        ISVALID  :=Field.AsFloat;
      end else
      if FieldName='IS_END' then
      begin
        ISEND    :=Field.AsFloat;
      end else
      if FieldName='APPROVE_DATE' then
      begin
        APPROVEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_DATE' then
      begin
        CREATEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_USER' then
      begin
        CREATEUSER:=Field.AsString;
      end else
      if FieldName='LATEST_OP_DATE' then
      begin
        LATESTOPDATE:=Field.AsString;
      end else
      if FieldName='LATEST_OP_USER' then
      begin
        LATESTOPUSER:=Field.AsString;
      end else
      if FieldName='LAST_VER' then
      begin
        LASTVER  :=Field.AsString;
      end else
      if FieldName='AUTO_REALPAY' then
      begin
        AUTOREALPAY:=Field.AsFloat;
      end else
      if FieldName='BUDGET_ADJUST' then
      begin
        BUDGETADJUST:=Field.AsString;
      end else
      if FieldName='BUDGET_CATEGORY' then
      begin
        BUDGETCATEGORY:=Field.AsString;
      end else
      if FieldName='BUDGET_VALID' then
      begin
        BUDGETVALID:=Field.AsString;
      end else
      if FieldName='HODE1' then
      begin
        HODE1    :=Field.AsString;
      end else
      if FieldName='HODE2' then
      begin
        HODE2    :=Field.AsString;
      end else
      if FieldName='HODE3' then
      begin
        HODE3    :=Field.AsString;
      end else
      if FieldName='HODE4' then
      begin
        HODE4    :=Field.AsString;
      end else
      if FieldName='HODE5' then
      begin
        HODE5    :=Field.AsString;
      end else
      if FieldName='B_VOUBILL_ID' then
      begin
        BVOUBILLID:=Field.AsString;
      end else
      if FieldName='ADJUST_ID' then
      begin
        ADJUSTID :=Field.AsString;
      end else
      if FieldName='ADJUST_WAY' then
      begin
        ADJUSTWAY:=Field.AsFloat;
      end else
      if FieldName='GRANT_ID' then
      begin
        GRANTID  :=Field.AsString;
      end else
      if FieldName='SUMMARY' then
      begin
        SUMMARY  :=Field.AsString;
      end else
      if FieldName='BILLTYPE_CODE' then
      begin
        BILLTYPECODE:=Field.AsString;
      end else
      if FieldName='BUDGETTYPE_CODE' then
      begin
        BUDGETTYPECODE:=Field.AsString;
      end else
      if FieldName='BA_ID' then
      begin
        BAID     :=Field.AsString;
      end else
      if FieldName='BA_CODE' then
      begin
        BACODE   :=Field.AsString;
      end else
      if FieldName='BA_NAME' then
      begin
        BANAME   :=Field.AsString;
      end else
      if FieldName='REPLACE_MODEL' then
      begin
        REPLACEMODEL:=Field.AsFloat;
      end else
      if FieldName='RCID' then
      begin
        RCID     :=Field.AsFloat;
      end else
      if FieldName='CCID' then
      begin
        CCID     :=Field.AsFloat;
      end else
      if FieldName='BUDGET_GROUPID' then
      begin
        BUDGETGROUPID:=Field.AsString;
      end else
      if FieldName='IS_NCYS' then
      begin
        ISNCYS   :=Field.AsFloat;
      end;
    end
  end;  
end;

class procedure TBUDGETVOUCHER.ReadDS(AUniQuery: TUniQuery; var Result: TUniEngine);
var
  I:Integer;
  Field:TField;
  FieldName:string;
begin
  if Result=nil then Exit;

  with TBUDGETVOUCHER(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      //if field.fieldname is not all uppercase,please use uppercase().
      FieldName:=Field.FieldName;
      if FieldName='B_VOU_ID' then
      begin
        BVOUID   :=Field.AsString;
      end else
      if FieldName='TOCTRLID' then
      begin
        TOCTRLID :=Field.AsString;
      end else
      if FieldName='FROMCTRLID' then
      begin
        FROMCTRLID:=Field.AsString;
      end else
      if FieldName='SET_YEAR' then
      begin
        SETYEAR  :=Field.AsFloat;
      end else
      if FieldName='RG_CODE' then
      begin
        RGCODE   :=Field.AsString;
      end else
      if FieldName='BUDGET_MONEY' then
      begin
        BUDGETMONEY:=Field.AsFloat;
      end else
      if FieldName='CHECK_MONEY' then
      begin
        CHECKMONEY:=Field.AsFloat;
      end else
      if FieldName='IS_VALID' then
      begin
        ISVALID  :=Field.AsFloat;
      end else
      if FieldName='IS_END' then
      begin
        ISEND    :=Field.AsFloat;
      end else
      if FieldName='APPROVE_DATE' then
      begin
        APPROVEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_DATE' then
      begin
        CREATEDATE:=Field.AsString;
      end else
      if FieldName='CREATE_USER' then
      begin
        CREATEUSER:=Field.AsString;
      end else
      if FieldName='LATEST_OP_DATE' then
      begin
        LATESTOPDATE:=Field.AsString;
      end else
      if FieldName='LATEST_OP_USER' then
      begin
        LATESTOPUSER:=Field.AsString;
      end else
      if FieldName='LAST_VER' then
      begin
        LASTVER  :=Field.AsString;
      end else
      if FieldName='AUTO_REALPAY' then
      begin
        AUTOREALPAY:=Field.AsFloat;
      end else
      if FieldName='BUDGET_ADJUST' then
      begin
        BUDGETADJUST:=Field.AsString;
      end else
      if FieldName='BUDGET_CATEGORY' then
      begin
        BUDGETCATEGORY:=Field.AsString;
      end else
      if FieldName='BUDGET_VALID' then
      begin
        BUDGETVALID:=Field.AsString;
      end else
      if FieldName='HODE1' then
      begin
        HODE1    :=Field.AsString;
      end else
      if FieldName='HODE2' then
      begin
        HODE2    :=Field.AsString;
      end else
      if FieldName='HODE3' then
      begin
        HODE3    :=Field.AsString;
      end else
      if FieldName='HODE4' then
      begin
        HODE4    :=Field.AsString;
      end else
      if FieldName='HODE5' then
      begin
        HODE5    :=Field.AsString;
      end else
      if FieldName='B_VOUBILL_ID' then
      begin
        BVOUBILLID:=Field.AsString;
      end else
      if FieldName='ADJUST_ID' then
      begin
        ADJUSTID :=Field.AsString;
      end else
      if FieldName='ADJUST_WAY' then
      begin
        ADJUSTWAY:=Field.AsFloat;
      end else
      if FieldName='GRANT_ID' then
      begin
        GRANTID  :=Field.AsString;
      end else
      if FieldName='SUMMARY' then
      begin
        SUMMARY  :=Field.AsString;
      end else
      if FieldName='BILLTYPE_CODE' then
      begin
        BILLTYPECODE:=Field.AsString;
      end else
      if FieldName='BUDGETTYPE_CODE' then
      begin
        BUDGETTYPECODE:=Field.AsString;
      end else
      if FieldName='BA_ID' then
      begin
        BAID     :=Field.AsString;
      end else
      if FieldName='BA_CODE' then
      begin
        BACODE   :=Field.AsString;
      end else
      if FieldName='BA_NAME' then
      begin
        BANAME   :=Field.AsString;
      end else
      if FieldName='REPLACE_MODEL' then
      begin
        REPLACEMODEL:=Field.AsFloat;
      end else
      if FieldName='RCID' then
      begin
        RCID     :=Field.AsFloat;
      end else
      if FieldName='CCID' then
      begin
        CCID     :=Field.AsFloat;
      end else
      if FieldName='BUDGET_GROUPID' then
      begin
        BUDGETGROUPID:=Field.AsString;
      end else
      if FieldName='IS_NCYS' then
      begin
        ISNCYS   :=Field.AsFloat;
      end;
    end
  end;  
end;

class function  TBUDGETVOUCHER.CopyIt(ABUDGETVOUCHER: TBUDGETVOUCHER): TBUDGETVOUCHER;
begin
  Result:=TBUDGETVOUCHER.Create;
  TBUDGETVOUCHER.CopyIt(ABUDGETVOUCHER,Result)
end;

class procedure TBUDGETVOUCHER.CopyIt(ABUDGETVOUCHER:TBUDGETVOUCHER;var Result:TBUDGETVOUCHER);
begin
  if Result=nil then Exit;
  Result.BVOUID   :=ABUDGETVOUCHER.BVOUID;
  Result.TOCTRLID :=ABUDGETVOUCHER.TOCTRLID;
  Result.FROMCTRLID:=ABUDGETVOUCHER.FROMCTRLID;
  Result.SETYEAR  :=ABUDGETVOUCHER.SETYEAR;
  Result.RGCODE   :=ABUDGETVOUCHER.RGCODE;
  Result.BUDGETMONEY:=ABUDGETVOUCHER.BUDGETMONEY;
  Result.CHECKMONEY:=ABUDGETVOUCHER.CHECKMONEY;
  Result.ISVALID  :=ABUDGETVOUCHER.ISVALID;
  Result.ISEND    :=ABUDGETVOUCHER.ISEND;
  Result.APPROVEDATE:=ABUDGETVOUCHER.APPROVEDATE;
  Result.CREATEDATE:=ABUDGETVOUCHER.CREATEDATE;
  Result.CREATEUSER:=ABUDGETVOUCHER.CREATEUSER;
  Result.LATESTOPDATE:=ABUDGETVOUCHER.LATESTOPDATE;
  Result.LATESTOPUSER:=ABUDGETVOUCHER.LATESTOPUSER;
  Result.LASTVER  :=ABUDGETVOUCHER.LASTVER;
  Result.AUTOREALPAY:=ABUDGETVOUCHER.AUTOREALPAY;
  Result.BUDGETADJUST:=ABUDGETVOUCHER.BUDGETADJUST;
  Result.BUDGETCATEGORY:=ABUDGETVOUCHER.BUDGETCATEGORY;
  Result.BUDGETVALID:=ABUDGETVOUCHER.BUDGETVALID;
  Result.HODE1    :=ABUDGETVOUCHER.HODE1;
  Result.HODE2    :=ABUDGETVOUCHER.HODE2;
  Result.HODE3    :=ABUDGETVOUCHER.HODE3;
  Result.HODE4    :=ABUDGETVOUCHER.HODE4;
  Result.HODE5    :=ABUDGETVOUCHER.HODE5;
  Result.BVOUBILLID:=ABUDGETVOUCHER.BVOUBILLID;
  Result.ADJUSTID :=ABUDGETVOUCHER.ADJUSTID;
  Result.ADJUSTWAY:=ABUDGETVOUCHER.ADJUSTWAY;
  Result.GRANTID  :=ABUDGETVOUCHER.GRANTID;
  Result.SUMMARY  :=ABUDGETVOUCHER.SUMMARY;
  Result.BILLTYPECODE:=ABUDGETVOUCHER.BILLTYPECODE;
  Result.BUDGETTYPECODE:=ABUDGETVOUCHER.BUDGETTYPECODE;
  Result.BAID     :=ABUDGETVOUCHER.BAID;
  Result.BACODE   :=ABUDGETVOUCHER.BACODE;
  Result.BANAME   :=ABUDGETVOUCHER.BANAME;
  Result.REPLACEMODEL:=ABUDGETVOUCHER.REPLACEMODEL;
  Result.RCID     :=ABUDGETVOUCHER.RCID;
  Result.CCID     :=ABUDGETVOUCHER.CCID;
  Result.BUDGETGROUPID:=ABUDGETVOUCHER.BUDGETGROUPID;
  Result.ISNCYS   :=ABUDGETVOUCHER.ISNCYS;
end;

end.

